<!--证书详情-->
<template>
    <a-modal v-model="showAddTable" :width="850"
             title="证书详情"
             :maskClosable="false"
             :destroyOnClose="true">
        <div class="modalDetail" v-if="JSON.stringify(info) !== '{}'">
            <p><em>证书指纹：</em><span>{{info.certFingerprint}}</span><br /></p>
            <p><em>证书主体名称：</em><span>{{info.subject}}</span><br /></p>
            <p><em>证书序列号：</em><span>{{info.serialNumber}}</span><br /></p>
            <p><em>算法标识：</em><span>{{info.algorithm}}</span><br /></p>
            <p><em>公钥算法：</em><span>{{info.pubkeyAlg}}</span><br /></p>
            <template v-if="isFrom==='ca'">
                <p><em>签名算法：</em><span>{{info.alias}}</span><br /></p>
                <p><em>证书类型：</em><span>{{ Util.changeKeyTypeName(info.certType,certTypeList)}}</span><br /></p>
            </template>
            <p><em>证书版本：</em><span>{{info.version}}</span><br /></p>
            <p><em>证书有效期：</em><span>{{info.notBefore}} 至 {{info.notAfter}}</span><br /></p>
            <p><em>签发者：</em><span>{{info.issuer}}</span><br /></p>
            <p><em>创建时间：</em><span>{{info.createTime}}</span><br /></p>
        </div>
        <div slot="footer">
            <a-button type="default" @click="cancelApply">取消</a-button>
        </div>
    </a-modal>
</template>

<script>
    import Util from '@/libs/util'

    export default {
        name: 'certDetail',
        data () {
            return {
                Util,
                showAddTable: false,
                info: {},
                isFrom:''
            }
        },
        computed: {
            certTypeList () {
                return this.$store.state.keyManage.certTypeList
            },
        },
        methods: {

            /**
             * Function    : showModal
             * Description : 打开弹框
             * Input       : none
             * Return      : none
             */
            showModal ( opt,data) {
                let _this = this
                _this.showAddTable = true
                _this.info = opt
                _this.isFrom = data
            },
            /**
             * Function    : cancelApply
             * Description : 取消弹出框
             * Input       : name
             * Return      : none
             */
            cancelApply () {
                this.showAddTable = false
                let _this = this
                setTimeout (function () {
                    _this.info = {}
                }, 100)
            }
        },
        created () {}
    }
</script>
